<?php

namespace app\admin\model;

use think\Model;

class Report extends Model
{

    // 表名
    protected $name = 'report';
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';

	protected function setReporttimeAttr($value)
    {
        return $value && !is_numeric($value) ? strtotime($value) : $value;
    }
	
	public function category()
    {
        return $this->belongsTo('ReportCategory', 'category_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
	
	public function depart()
    {
        return $this->belongsTo('AdminDepart', 'department', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
